package com.yjc.springyjcdemo.controller;

import com.yjc.springyjcdemo.entity.YjcTest;
import com.yjc.springyjcdemo.service.TestService;
import com.yjc.springyjcdemo.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author:shishumin
 * @Date:2021/11/20
 */
@RestController
public class TestController {

    @Autowired
    private TestService testService;

    @RequestMapping("test")
    public String test(){
        System.out.println(11);
        return "hello";
    }

    @RequestMapping("get")
    public YjcTest get(@RequestParam int id){
        YjcTest list = testService.get(id);
        return list;
    }

    @RequestMapping("getList")
    public List<YjcTest> getList(){
        List<YjcTest> list = testService.getList();
        return list;
    }

    @RequestMapping("insert")
    public Result insert(@RequestBody YjcTest yjcTest) {
        return testService.insert(yjcTest);
    }


}
